﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NumberBoxChooseLine : MonoBehaviour
{
    public NumberBox m_ChooseBox;
    public NumberBox m_NumberBoxPerfab;
    List<NumberBox> m_Numbers = new List<NumberBox>();
    void Start()
    {
        for(int i=0; i<10; ++i)
        {
            var box = Instantiate(m_NumberBoxPerfab);
            box.Number = i;
            box.CallbackNumberBoxClicked = OnNumberBoxClicked;
            box.transform.SetParent(transform);
            box.transform.localScale = new Vector3(1, 1, 1);
            m_Numbers.Add(box);
        }
    }

    // Update is called once per frame
    void Update()
    {
        
    }
    public void OnNumberBoxClicked(NumberBox box)
    {
        if (m_ChooseBox == null)
            return;
        m_ChooseBox.Number = box.Number;
        m_ChooseBox = null;
        gameObject.SetActive(false);

    }
}
